package com.itheima.exception;


import com.itheima.utils.EmailUtil;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/*@Component
@ControllerAdvice*/
public class ExceptionEmailAdive {

    @ExceptionHandler(Exception.class)
    public void doEx(Exception e){
        System.out.println("系统出现错误！！");
        EmailUtil.sendMail("1768566718@qq.com","系统出现异常，请及时查看"+e.getMessage(),"出现异常了");
    }
}
